package test

import (
	"encoding/json"
	"fmt"
	"log"
	"os"
)

func _print(data any) {
	j, _ := json.MarshalIndent(data, "", "  ")
	fmt.Println(string(j))
}

func _check(err error) {
	if err != nil {
		_ = log.Output(2, fmt.Sprintln(err))
		os.Exit(1)
	}
}

func _check2[T any](v1 T, err error) T {
	if err != nil {
		_ = log.Output(2, fmt.Sprintln(err))
		os.Exit(1)
	}
	return v1
}

func _true(ok bool, msg string) {
	if !ok {
		_ = log.Output(2, msg)
		os.Exit(1)
	}
}
